<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="utf-8">
    <meta name="referrer" content="no-referrer" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>商品管理(社区)</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-body">

                    <ul id="myTabs" class="nav nav-tabs" role="tablist">
                        <li class="active"><a href="#sale" id="sale-tab" role="tab" data-toggle="tab" onclick="tabChange(1,'sale_data')">出售中的商品(<span id="saleTotal">0</span>)</a></li>
                        <li><a href="#reviewed" role="tab" id="reviewed-tab" data-toggle="tab" onclick="tabChange(2,'reviewed_data')">审核中的商品(<span id="reviewedTotal">0</span>)</a></li>
                        <li><a href="#out" role="tab" id="out-tab" data-toggle="tab" onclick="tabChange(3,'out_data')">已经售馨商品(<span id="outTotal">0</span>)</a></li>
                        <li><a href="#warning" role="tab" id="warning-tab" data-toggle="tab" onclick="tabChange(4,'warning_data')">库存警戒商品(<span id="warningTotal">0</span>)</a></li>
                        <li><a href="#off" role="tab" id="off-tab" data-toggle="tab" onclick="tabChange(5,'off_data')">已经下架商品(<span id="offTotal">0</span>)</a></li>
                        <li><a href="#off" role="tab" id="unReviewed-tab" data-toggle="tab" onclick="tabChange(6,'unReviewed_data')">审核不通过商品(<span id="unReviewedTotal">0</span>)</a></li>
                    </ul>
                    <div id="myTabContent" class="tab-content">
                        <form class="form-inline" method="post" id="searchUserForm">
                            <div class="form-group">
                                <label>商品名称:</label>
                                <input type="hidden" class="form-control" name="status">
                                <input type="text" class="form-control" name="username">
                            </div>
                            <div class="form-group">
                                <label>用户账号:</label>
                                <input type="text" class="form-control" name="account">
                            </div>
                            <div class="form-group">
                                <button class="btn btn-info btn_query btn-round" type="button" id="searchUserFormBtn">查询</button>
                                <button class="btn btn-success btn_query btn-round" type="button" id="addBtn">添加商品</button>
                            </div>
                        </form>
                        <div class="tab-pane fade active in" id="sale">
                            <table id="sale_data"></table>
                        </div>
                        <div class="tab-pane fade" id="reviewed">
                            <table id="reviewed_data"></table>
                        </div>
                        <div class="tab-pane fade" id="out">
                            <table id="out_data"></table>
                        </div>
                        <div class="tab-pane fade" id="warning">
                            <table id="warning_data"></table>
                        </div>
                        <div class="tab-pane fade" id="off">
                            <table id="off_data"></table>
                        </div>
                        <div class="tab-pane fade" id="unReviewed">
                            <table id="unReviewed_data"></table>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>

</div>
</body>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>

<script type="text/javascript">

    var columns = [
        {field: 'id',title: 'ID'},
        {field: 'name',title: '分类名称'},
        {field: 'category_level',title: '分类级别'},
        {field: 'order_id',title: '分类排序'},
        {field: 'open',title: '是否展开'},
        {field: 'icon_cls',title: '分类图标', visible: false},
        {field: 'category_status',title: '分类状态'}
    ];

    //进入主界面加载数据
    zero2one.datagrid("sale_data", "/remote/goodsCategory/list",function (params) {
        return $.extend(zero2one.tableInitParam(params), zero2one.form2json("searchForm"));
    }, columns);

    function tabChange(params, el) {
        $("input[name='status']").val(params);
        zero2one.datagrid(el, "/remote/goodsCategory/list",function (params) {
            return $.extend(zero2one.tableInitParam(params), zero2one.form2json("searchForm"));
        }, columns);
        $("#saleTotal").html($("#"+el).bootstrapTable("getOptions").totalRows);
    }

    $("#addBtn").click(function () {
        zero2one.tab("添加商品(社区)","/toView?url=service/goods/addCommunityGoods",108);
    })

</script>

</html>
